import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    orderDatas: [

    ],
    loginFlag:false,
    money:1000
  },
  mutations: {
    edit(state, data) {
      data.prize *= data.num;
      state.orderDatas.push(data)
    },
    del(state, data) {
      console.log(data.index);
      state.orderDatas.splice(data.index, 1)
    },
    change(state, data) {
      state.orderDatas[data.index].flag = true;
      state.money -= state.orderDatas[data.index].prize;
    },
    login(state) {
      state.loginFlag = true;
    }
  },
  actions: {
  },
  modules: {
  }
})
